package cn.wolfcode.p2p.mgrsite.controller;

import cn.wolfcode.p2p.base.excetion.DisplayableExcetion;
import cn.wolfcode.p2p.base.query.QueryObjext;
import cn.wolfcode.p2p.base.service.ILofinInfoService;
import cn.wolfcode.p2p.base.service.IOrdertimeService;
import cn.wolfcode.p2p.base.service.IUserInfoService;
import cn.wolfcode.p2p.base.service.IVideoauthService;
import cn.wolfcode.p2p.base.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//后台视频审核
@Controller
public class VideoauthController {

    @Autowired
    private IVideoauthService videoauthService;
    @Autowired
    private ILofinInfoService lofinInfoService;
    @Autowired
    private IOrdertimeService ordertimeService;
    @Autowired
    private IUserInfoService userInfoService;

    @RequestMapping("/videoAuth")
    public String realAuth(Model model, @ModelAttribute("qo") QueryObjext qo) {
        model.addAttribute("pageInfo", videoauthService.queryPage(qo));
        return "/videoAuth/list";
    }

    //后台视频审核
    @RequestMapping("/videoAuth_audit")
    @ResponseBody
    public AjaxResult audit(Integer state,Long videoAuthId,String remark) {
        AjaxResult result = null;
        try {
            videoauthService.audit(state,videoAuthId,remark);
            result = new AjaxResult();
        } catch (DisplayableExcetion e) {
            e.printStackTrace();
            result = new AjaxResult(false, e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            result = new AjaxResult(false, "系统出错,请联系管理员");
        }
        return result;
    }



}
